1. Field of the Invention
The present invention generally relates to a load-distribution method and apparatus therewith, and particularly relates to a load-distribution method and apparatus therewith for a processing server and a link between nodes in a network.
2. Description of the Related Art
With a rapid increase in an amount of packets transmitted or processed by the Internet, a potential packet transfer capacity which one link cannot transfer, and a potential packet processing capacity which one server cannot process have been required, which in turn calls for a load distribution of these packets over a plurality of links and servers for transfer and processing, respectively. Further, since transfer and processing capacities usually differ from link to link, and from server to server, respectively, it is necessary to distribute packets in proportion to their respective transfer and processing capacities.
FIG. 1 is a block diagram of an example of a conventional load-distribution apparatus, and FIG. 2 shows how output terminals are selected with reference to FIG. 1. In FIG. 1, a packet received from a network is supplied to a switch unit 10, and an address and the like of the packet are supplied to a Hash-function generating unit 12 as a key. The Hash-function generating unit 12 generates a random number between 0 and 99, for example, by applying the Hash function to this key, and supplies the number to the output selection unit 14. The output selection unit 14 is set up with predetermined weights such that when the random number falls between 0 and 49, for example, an output terminal 16a shall be selected, when the random number falls between 50 and 79, for example, an output terminal 16b shall be selected, and if the random number falls between 80 and 99, for example, an output terminal 16c shall be selected. The output selection unit 14 supplies a selection direction signal to the switch unit 10 according to the value from the Hash-function generating unit 12. The switch unit 10 switches the packet supplied according to this selection direction signal, and sends the packet to a link or server via one of the output terminals 16a, 16b, and 16c, which is assigned according to the weight.
FIG. 3 is a block diagram of another example of the conventional load-distribution apparatus, and FIG. 4 shows how output terminals are selected with reference to FIG. 3. In FIG. 3, a packet received from the network is supplied to a switch unit 20 and an output selection unit 22. The output selection unit 22 includes an output selection table 26 where a line is prepared for each of output terminals 24a, 24b, and 24c, each of which is given the number of assigned packets and weight value.
Whenever a packet is supplied, the output selection unit 22 searches a line which a pointer 28 in the output selection unit 22 indicates, reads the number of assigned packets and the weight value of the line that is pointed, and compares the number of the assigned packets with the weight value in a comparison unit 30. If the number of the assigned packets is found to be equal to or larger than the weight value, the comparison unit 30 directs the pointer 28 to move to the next line. If the number of the assigned packets is smaller than the weight value, the output selection unit 22 will supply a selection direction signal to the switch unit 20, which will select an output terminal corresponding to the line that is currently pointed to. The switch unit 20 switches the packet supplied according to this selection direction signal, and sends this packet to a link or server via one of the output terminals 24a, 24b, and 24c, assigned according to the weight.
In addition, when the number of assigned packets of all the lines of the table 22 becomes equal to or larger than the respective weight value, the number of assigned packets of all lines is reset to 0.
In the conventional practice described above using FIG. 1, the random number has unevenness that results from unevenness of the Hash function and the key. That requires counting a total of the number of packets assigned to a link or a server actually, and periodically adjusting a link or a server that is assigned to each random number obtained from the Hash function so that packets are assigned to each link or server according to the weight values.
Further, a problem has been that, even if the random number is truly random, unevenness is probable for a short period of time, and therefore, it takes a long period to achieve an adequate load distribution according to the weight.
In the conventional example as described with reference to FIG. 3, there has been a problem in that if the weight values differ greatly, packet assignment will be concentrated to a link or a server that has a large weight value after packet assignment to a link or a server having a small weight value is finished until the number of assigned packets is reset.